package com.aidex.biz.mapper;

import com.aidex.biz.domain.Customer;
import com.aidex.biz.domain.CustomerDongtai;
import com.aidex.biz.domain.CustomerTag;
import com.aidex.biz.domain.JinjianInfo;
import com.aidex.biz.domain.bo.BusinessSetBo;
import com.aidex.biz.domain.vo.CustomerExpertVo;
import com.aidex.biz.domain.vo.YuanGongGongziVo;
import com.aidex.common.core.domain.entity.SysUser;
import com.aidex.common.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 左心房客户推送信息Mapper接口
 *
 * @author sean
 * @email 2074844820@qq.com
 * @date 2023-04-03
 */
public interface CustomerMapper extends BaseMapper<Customer> {

    /**
     * 批量删除左心房客户推送信息
     *
     * @param ids 需要删除的左心房客户推送信息ID集合
     * @return
     */
    public int deleteCustomerByIds(String[] ids);

    /**
     * 获取最大编号
     *
     * @param customer 左心房客户推送信息
     * @return 结果
     */
    public Integer findMaxSort(Customer customer);

    /**
     * @return 查询一个待分配的用户
     */
    public Customer findOne();

    /**
     * @return 查询一个撞库待分配的用户
     */
    public Customer findZkOne();

    /**
     * @return 查询一个未接待分配的用户
     */
    public Customer findWjOne();

    /**
     * 修改客户状态
     *
     * @param customer
     * @return
     */
    public Integer updateStatus(Customer customer);


    /**
     * 公海状态
     *
     * @param customer
     * @return
     */
    public Integer updateMyStatus(Customer customer);

    public Customer findByPhone(Customer customer);

    public List<Customer> findByNameOrPhone(Customer customer);

    public List<Customer> findListXieZu(Customer customer);

    public List<Customer> findgonghaiList(Customer customer);

//    public List<Customer> findAllList(Customer customer);

    public List<Customer> findXiansuoList(Customer customer);

    public List<Customer> findMyList(Customer customer);

    public List<Customer> findChengJiaoList(Customer customer);

    public List<CustomerExpertVo> findAllExportList();

    public List<Customer> findDaigenjinList(Customer customer);

    public List<Customer> findCustomerWithJoinList(Customer customer);

    public List<CustomerDongtai> findDongtaiListByCustomerIds(List<Customer> customers);

    public List<JinjianInfo> findJinjianListByCustomerIds(List<Customer> customers);

    /**
     * 工资统计
     */
    public List<YuanGongGongziVo> yuangonggongzitongji(Customer customer);


    /**
     * 已成交客户自动变更设置
     */
    public void updateStatusByJinJianStatus(JinjianInfo jinjianInfo);


    /**
     * /*我的客户领取后 x小时内，没有跟进，去公海。锁住的客户除外
     */
    public void updateStatusToHongHai48(BusinessSetBo businessSetBo);

    /**
     * /*客户被领取后，前x(天)内，未连续跟进，客户自动转入公海。锁住的客户除外
     */
    public void updateStatusToHongHai3(@Param("array") String[] ids);


    /**
     * /*客户被跟进后x(天)内，未再跟进，客户自动转入公海。锁住的客户除外
     */
    public void updateStatusToHongHai15(BusinessSetBo businessSetBo);


    /**
     * *线索池内，没有跟进，去公海*
     */
    public void updateStatusToHongHaiXianSuoChi(BusinessSetBo businessSetBo);

    /**
     * 插入我的客户流转到公海的动态(未跟进)
     *
     * @param params
     */
    public void insertDongtaiByStatusToHongHai48(Map<String, Object> params);


    /**
     * 插入我的客户流转到公海的动态（未再跟进）
     *
     * @param params
     */
    public void insertDongtaiByStatusToHongHai15(Map<String, Object> params);

//    /**
//     * 插入我的客户流转到公海的动态（未连续跟进）
//     *
//     * @param params
//     */
//    public void insertDongtaiByStatusToHongHai3(Map<String, Object> params);

    /**
     * 插入线索池的客户流转到公海的动态（未跟进）
     *
     * @param params
     */
    public void insertDongtaiByStatusToHongHaiXianSuoChi(Map<String, Object> params);

    /**
     * 取消标记重复客户
     */
    public void updateStatusCancelRep(BusinessSetBo businessSetBo);

    /**
     * 取消锁定
     */
    public void updateStatusCancelLock(BusinessSetBo businessSetBo);

    /**
     * 查询已经锁客多少人
     */
    public Integer findLocks(Customer customer);

    /**
     * 锁客
     */
    public Integer lockCustomer(Customer customer);

    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectToHongHai48(BusinessSetBo businessSetBo);

    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectToHongHai3(BusinessSetBo businessSetBo);

    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectToHongHai15(BusinessSetBo businessSetBo);


    /**
     * @param customer
     * @return
     */
    public List<Customer> selectToHongHai15(Customer customer);


    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectToHongHaiXianSuoChi(BusinessSetBo businessSetBo);

    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectIsRepToTime(BusinessSetBo businessSetBo);

    /**
     * @param businessSetBo
     * @return
     */
    public List<Customer> selectIsLockToTime(BusinessSetBo businessSetBo);

    /**
     * @param jinjianInfo
     * @return
     */
    public List<Customer> selectCustomerIdByJinJianStatus(JinjianInfo jinjianInfo);


    /**
     * 查询10分钟内未跟进
     *
     * @param businessSetBo
     * @return
     */
    public List<Customer> findNotGen(BusinessSetBo businessSetBo);

    /**
     * 重新分配
     */
    public Integer updateNotGen(Customer customer);

    /**
     * 员工离职 客户转入公海
     *
     * @param ids 员工ID
     * @return
     */
    public int deleteUsersToGongHai(String[] ids);


    public Integer updateIsHeart(Customer customer);

    /**
     * 获取公海客户 进行重新分配
     *
     * @return
     */
    public Customer findGonghaiOne();

    /**
     * 潜在客户
     *
     * @param customer
     * @return
     */
    public List<Customer> findZhuangKuList(Customer customer);

    /**
     * 根据客户查找客户标签
     *
     * @param customers
     * @return
     */
    public List<CustomerTag> findTagListByCustomerIds(List<Customer> customers);


    /**
     * 我的接单列表
     *
     * @param customer
     * @return
     */
    public List<Customer> findMyReceiveList(Customer customer);

    /**
     * 查询未接超时流转的客户
     *
     * @param businessSetBo
     * @return
     */
    public List<Customer> findWjExceedTimeToShareList(BusinessSetBo businessSetBo);

    /**
     * 查询未接超次数流转的客户
     *
     * @param businessSetBo
     * @return
     */
    public List<Customer> findWjExceedCountToShareList(BusinessSetBo businessSetBo);

    public int batchShareCustomersToUserByIds(@Param("customer") Customer customer, @Param("user") SysUser user);

    public int updateStatusToWeiJie(List<Customer> list);

    /**
     * 插入公海流转记录表
     *
     * @param params
     */
    public void insertCustomerTestToHongHai15(Map<String, Object> params);
}
